package com.ruoyi.business.approvalflow.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.business.approvalflow.domain.TRegisterApprovalFlow;
import com.ruoyi.business.approvalflow.vo.TRegisterApprovalFlowVo;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 退款审批流程Service接口
 *
 * @author Tellsea
 * @date 2025-06-22
 */
public interface ITRegisterApprovalFlowService extends IService<TRegisterApprovalFlow> {

    /**
     * 分页查询
     *
     * @param entity
     * @return
     */
    TableDataInfo<TRegisterApprovalFlowVo> queryList(TRegisterApprovalFlowVo entity);

    /**
     * 查询全部
     *
     * @param entity
     * @return
     */
    List<TRegisterApprovalFlowVo> queryAll(TRegisterApprovalFlowVo entity);

    /**
     * 根据ID查询
     *
     * @param approvalId
     * @return
     */
    TRegisterApprovalFlowVo queryById(String approvalId);

    /**
     * 根据登录人查询待审批的数据
     *
     * @param businessIdList
     * @param userId
     * @return
     */
    List<TRegisterApprovalFlowVo> queryWaitApprove(String processId, List<String> businessIdList, Long userId);

    /**
     * 根据业务的id查询待审批数据
     *
     * @param businessIdList
     * @return
     */
    List<TRegisterApprovalFlowVo> queryWaitApprove(String processId, List<String> businessIdList);

    void initApprovalFlows(String processId, String businessId, Long registerId);

    @Transactional
    void processApproval(String approvalId, Integer status, String opinion) throws Exception;

    void checkApprovalProcessOrder(String processId, String businessId, Integer approvalLevel) throws Exception;

    List<TRegisterApprovalFlowVo> getAllApprovalFlowByApproval(String approvalId);
}
